package com.hx.util.resource;

import java.util.ResourceBundle;
public class ResourceUtil {
	public static ResourceBundle dao_b2c = ResourceBundle.getBundle("dao_b2c");
	public static ResourceBundle b2c_msg = ResourceBundle.getBundle("dao_msg");
	public static ResourceBundle b2c_bank = ResourceBundle.getBundle("dao_bank");
	/**
	 * 获取dao_b2c.properties配置中key对应的string值
	 * 
	 * @param p_key
	 * @return  
	 */
	public static String getStrValue(String p_key) {
		if(p_key==null ||"".equals(p_key)){
		   return "";
		}
		return dao_b2c.getString(p_key);
	}
	
	/**
	 * 获取dao_b2c.properties配置中key对应的boolean值
	 * 
	 * @param p_key
	 * @return  
	 */
	public static boolean getBooleanValue(String p_key) {
		boolean value = false;
		if(p_key==null || "".equals(p_key)){
			return value;
		}
		try{
			value = new Boolean(dao_b2c.getString(p_key)).booleanValue();
		}catch(Exception e){
			value = false;
		}
		return value;
	}
	
	/**
	 * 获取dao_msg.properties配置中key对应的提示消息
	 * 
	 * @param p_key
	 * @return  
	 */
	public static String getMsg(String p_key) {
		if(p_key==null ||"".equals(p_key)){
		   return "";
		}
		return b2c_msg.getString(p_key);
	}
	
	/**
	 * 获取dao_msg.properties配置中key对应的提示消息
	 * 
	 * @param p_key
	 * @return  
	 */
	public static String getBank(String p_key) {
		if(p_key==null ||"".equals(p_key)){
		   return "";
		}
		return b2c_bank.getString(p_key);
	}

	/**
	 * 获取指定位置资源信息
	 * 
	 * @param p_srcPath
	 * @param p_key
	 * @return 调用指定路径下面 切记 不写后缀 .properties
	 *         ResourceUtil.getResourceInfo("com.qishun.getResource.warn_resource1"
	 *         , "test")
	 */
	/*public static String getResourceInfo(String p_srcPath, String p_key) {
		if(p_srcPath==null || p_key ==null){
			return null;
		}
		String result = null;
		try{
			result = ResourceBundle.getBundle(p_srcPath).getString(p_key);
		}catch(Exception e){
			e.printStackTrace();
		}
		return result;
	}*/

	
}
